home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / CRS / crs54.d81 / sgtool13.arc / SGCTOOLS.DOC < prev    next >
Text File  |  1993-08-28  |  8KB  |  212 lines

  1. ___________________________________________________________________
  2.  
  3.                          SG C Tools 1.3
  4.                     (C) 1993 Steve Goldsmith
  5.                        All Rights Reserved
  6. ___________________________________________________________________
  7.  
  8.  
  9. NOTICE
  10.  
  11. THIS IS NOT FREE SOFTWARE!  If you paid a public domain vendor or
  12. communications service for this product, you paid for the service
  13. of copying or transferring the product, and not for the product
  14. itself.  I guarantee you that nothing ever gets to the originator
  15. of this product from such a sale.  You may evaluate this product,
  16. but if you make use of it, you must register your copy.
  17.  
  18. I offer several incentives for you to register.  First of all,
  19. you receive the most up-to-date copy that I have which is updated
  20. on a regular basis.  Unregistered releases do not include Assembler
  21. source files or bonus modules and programs.  Support via GEnie,
  22. Internet (via GEnie), US Mail or phone from the author.
  23.  
  24.  
  25. REGISTRATION INFORMATION
  26.  
  27. The non-commercial registration fee for SG C Tools 1.3 is $10.00
  28. plus $3.00 for shipping in US funds.
  29.  
  30. Send a check or money order for the appropriate amount to:
  31.  
  32. Steve Goldsmith
  33. 2805 Jamaica Street
  34. Sarasota, FL 34231
  35.  
  36. Please indicate what product you are ordering and if you have a
  37. requirement for 3.5" media.  I normally ship 5.25" Commodore GCR
  38. format diskettes, but will furnish 3.5" media upon request.
  39. Customers outside of the United States and Canada should include an
  40. extra $5.00 for airmail.
  41.  
  42. If you are a registered user of this product and desire an update,
  43. please contact me for upgrade prices.
  44.  
  45.  
  46. DISTRIBUTION NOTICE
  47.  
  48. This is "user-supported" software.  You are hereby granted a
  49. license by Steve Goldsmith to distribute this evaluation copy of SG
  50. C Tools and its documentation, subject to the following conditions:
  51.  
  52. 1.   SG C Tools may be distributed freely without charge in
  53.      evaluation form only.
  54.  
  55. 2.   SG C Tools may not be sold, licensed, or a fee charged for its
  56.      use.  If a fee is charged in connection with SG C Tools, it
  57.      must cover the cost of copying or dissemination only.  Such
  58.      charges must be clearly identified as such by the originating
  59.      party.  Under no circumstances may the purchaser be given the
  60.      impression that he is buying SG C Tools itself.
  61.  
  62. 3.   SG C Tools must be presented as a complete unit, including
  63.      this documentation.   Neither SG C Tools nor its documentation
  64.      may be amended or altered in any way.
  65.  
  66. 4.   By granting you the right to distribute the evaluation form of
  67.      SG C Tools, you do not become the owner of SG C Tools in any
  68.      form.  Any other use, distribution or representation of SG C
  69.      Tools is expressly forbidden without the written consent of
  70.      Steve Goldsmith.
  71.  
  72. Commodore 128 is a trademark of Commodore Business Machines.  CP/M
  73. and CP/M 3.0 are trademarks of Digital Research.  MS-DOS and
  74. Windows are trademarks of Microsoft.  IBM PC,  PC-XT and PC-AT are
  75. trademarks of International Business Machines.
  76.  
  77.  
  78. OVERVIEW
  79.  
  80. SG C Tools ANSI C library unlocks the power of a C128 running CP/M! 
  81. High level and low level functions are included to access the VDC,
  82. SID and CIA.  All source code is compatible with the Freeware
  83. version of Hi Tech C.  A demo is included to show you how to use
  84. most features.
  85.  
  86.  
  87. REQUIREMENTS
  88.  
  89. A C128 or C128D running CP/M 3.0 or a IBM PC running a CP/M
  90. emulator and DOS to CP/M file transfer software.
  91.  
  92. At least one 1581, two 1571s, large RAM disk or hard drive to
  93. compile on a C128.
  94.  
  95. 80 column monitor for VDC specific routines.
  96.  
  97. ANSI C programming experience.
  98.  
  99.  
  100. MODIFICATIONS IN VERSION 1.3
  101.  
  102. vdcCharMem is initialized to the default value of 0x2000 because
  103. reading VDC register 28 will only return the values 0x2000, 0x6000,
  104. 0xA000 and 0xE000.  Your application must keep track of vdcCharMem
  105. since vdcmap() no longer updates this value.
  106.  
  107.  
  108. Added SID functions to clear all registers, set master volume,
  109. envelope, frequency, filters, pulse width, execute ADSR cycle, read
  110. pots and 1351 compatible mouse.
  111.  
  112. Added CIA functions to set/read time of day clocks, convert TOD
  113. clock BCD values to ASCII string, set/read timers A and B, convert
  114. Hz to timer latch value, set interrupt control, low level keyboard
  115. and joy stick scanning.
  116.  
  117. circlevdc() doesn't draw true circles due to the aspect ratio of
  118. 640 X 200 bit map mode.  I did some correction by reducing Y axis
  119. plots by 50%.  A general ellipse algorithm would be better.  It
  120. involves a new formula in terms of the P parameter (see VDCCIR.C). 
  121. If you come up with one I'll give you a free registered copy!  I
  122. really need to get some graphics books instead of hacking this
  123. stuff!
  124.  
  125.  
  126. COMPILING SOURCE CODE WITH HI-TECH C 3.09
  127.  
  128. First you will need to have a copy of HI-TECH C 3.09 (CP/M-80). 
  129. You can download the following Freeware files from GEnie's CP/M RT
  130. (M685;3) or other source:
  131.  
  132.  8149 LIBSRC.LZH               X BRIAN-CPM    930616   80384     39 
  133.  3
  134.       Desc: Source Code to Hitech C library
  135.  8148 Z80V309.LZH              X BRIAN-CPM    930616  194304     51 
  136.  3
  137.       Desc: Hitech C Compiler for CP/M
  138.  8147 Z80DOC.LZH               X BRIAN-CPM    930616   89088     55 
  139.  3
  140.       Desc: Documentation for Hitech C compiler
  141.  
  142. You should look over HI-TECH C's manual and compile a simple "hello
  143. world" program before proceeding.  I installed all the compiler
  144. related files on my 1581.  My source and header files are on a
  145. 1571.  You could get away with two 1571s, but a RAM disk or hard
  146. drive would be better.  You could also use a CP/M-80 emulator on
  147. the IBM PC and copy compiled files to C128 for testing.
  148.  
  149. To compile sample programs use:
  150.  
  151. C -O -X FILENAME.C -LC128
  152.  
  153.  
  154. PROGRAMMING CONSIDERATIONS
  155.  
  156. The VDC should be configured to its default CP/M 3.0 settings at
  157. the start and end of each program.
  158.  
  159. Display memory        0000h
  160. Attribute memory      0800h
  161. Character definitions 2000h
  162.  
  163. This includes restoring character definitions if you use memory at
  164. 2000h for something else like a bit map.  Setting the VDC to 64K
  165. mode wipes out memory used in 16K mode, so be sure to save the
  166. character definitions to a memory buffer or file before using 64K
  167. mode.  The VDC remains in 64K mode until you do a cold boot or warm
  168. boot with the C128's reset button.
  169.  
  170. Most of the VDC functions do not check parameters for range
  171. violations.  Range checking should be preformed at the application
  172. level.  There are times when you may want to write to a off screen
  173. memory location.  For this reason there is no need to waste time
  174. and code doing range checks.  Just be aware of the implications. 
  175. A renegade program may accidentally wipe out character definitions
  176. or other important memory regions forcing you to reboot.
  177.  
  178. Basically, just return to CP/M the way it was before your program
  179. ran.  See DEMO.C for a complete example of setting various VDC
  180. modes and exiting back to CP/M correctly.
  181.  
  182. CP/M relies on the CIAs for communication to the outside world just
  183. like in native 64/128 modes.  With this in mind it is best not to
  184. change certain registers.  I have found it safe to use CIA #2's TOD
  185. clock, timers A and B and disable all interrupt sources.  You can
  186. also safely read the keyboard and joy sticks via CIA #1 if you
  187. disable interrupts.  My low level key scan function reads all key
  188. positions into an array of 11 bytes.  See page 642 of the Commodore
  189. 128 Programmer's Reference for the key positions in the matrix. 
  190. You can tell joy stick signals from a key short because the joy
  191. stick shorts a whole row in the matrix instead of one bit like a
  192. key press.  See page 32 of the 1351 Mouse User's manual for more
  193. info.
  194.  
  195. CP/M only uses voice 1 of the SID to produce a key click.  You can
  196. use the SID just as you would in native 128 mode with one
  197. exception.  Since CP/M writes to the SID during key presses it may
  198. affect a sound in progress.  You can disable interrupts to
  199. eliminate this problem.
  200.  
  201.  
  202. HOW TO CONTACT ME
  203.  
  204. Please report any support questions, problems, suggestions, etc. to
  205. me via GEnie S.GOLDSMITH2, Internet S.GOLDSMITH2@GENIE.GEIS.COM,
  206. voice phone (813) 925-1064 or US Mail to:
  207.  
  208. Steve Goldsmith
  209. 2805 Jamaica Street
  210. Sarasota, FL 34231
  211. USA
  212.